package com.dgshanger.sanhxiaofeisc.ui.home.activity

import android.view.KeyEvent
import com.blankj.utilcode.util.TimeUtils
import com.dgshanger.sanhxiaofeisc.MainActivity
import com.dgshanger.sanhxiaofeisc.R
import com.dgshanger.sanhxiaofeisc.mvp.contract.SubmitSuccessContract
import com.dgshanger.sanhxiaofeisc.mvp.presenter.SubmitSuccessPresenter
import com.xx.baseuilibrary.mvp.BaseMvpActivity
import kotlinx.android.synthetic.main.activity_submit_success.*
import java.text.SimpleDateFormat

/**
 * Created by JacobHHH on 2018/4/22.
 * 提交成功
 */
class SubmitSuccessActivity :BaseMvpActivity<SubmitSuccessContract.Model,SubmitSuccessContract.View, SubmitSuccessPresenter>(),SubmitSuccessContract.View {

    override fun createPresenter(): SubmitSuccessPresenter = SubmitSuccessPresenter()

    override fun getActivityLayoutId(): Int = R.layout.activity_submit_success

    override fun initData() {
        tv_code.text=intent.getStringExtra("apply_sn")
        tv_time.text=TimeUtils.millis2String(System.currentTimeMillis(), SimpleDateFormat("yyyy-MM-dd hh:mm"))

    }

    override fun initEvent() {
        ib_back2.setOnClickListener{
            startActivity(MainActivity::class.java)
        }
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            startActivity(MainActivity::class.java)
            return true
        }
        return super.onKeyDown(keyCode, event)
    }
}